CC := gcc

log := thirdparty/log/log.h thirdparty/log/log.c 


json:=thirdparty/cJSON/cJSON.h thirdparty/cJSON/cJSON.c


app_common := app/app_common.h app/app_common.c

app_pool:= app/app_pool.h app/app_pool.c

app_buffer:= app/app_buffer.h app/app_buffer.c


app_msg := app/app_msg.h app/app_msg.c
app_msg_test: test/app_msg_test.c $(log) $(app_common) $(app_msg) $(json)
	-$(CC) $^ -o $@ -Ithirdparty  -Iapp
	-./$@
	-rm  $@

app_buffer_test: test/app_buffer_test.c $(log) $(app_common) $(app_buffer)
	-$(CC) $^ -o $@ -Ithirdparty  -Iapp
	-./$@
	-rm  $@



pool_test: test/pool_test.c $(log)  $(app_pool)
	-$(CC) $^ -o $@ -Ithirdparty  -Iapp
	-./$@
	-rm  $@


thread_test3: test/thread_test3.c $(log)
	-$(CC) $^ -o $@ -Ithirdparty
	-./$@
	-rm $@


thread_test2: test/thread_test2.c $(log)
	-$(CC) $^ -o $@ -Ithirdparty
	-./$@
	-rm $@


thread_test1: test/thread_test1.c $(log)
	-$(CC) $^ -o $@ -Ithirdparty 
	-./$@
	-rm $@


mqtt_test: test/mqtt_test.c $(app_common) $(log)
	-gcc $^ -o $@ -Ithirdparty -Iapp -lpaho-mqtt3c
	-./$@
	-rm $@

app_common_test: test/common_test.c $(app_common) $(log)
	-gcc $^ -o $@ -I thirdparty -I app
	./$@
	-rm $@

cjson_test: test/cjson_test.c $(json) $(log)
	-$(CC) $^ -o $@ -Ithirdparty
	-./$@
	-rm $@


CFLAGS := -g -O0 -Wall
log_test2: test/log_test.c $(log) 
	-$(CC) $(CFLAGS) $^ -o $@ -Ithirdparty
	./$@
	rm $@

log_test: test/log_test.c $(log) 
	-$(CC) $^ -o $@ -Ithirdparty
	./$@
	rm $@

